{# This file contains generators for thread configurations #}

{% macro xid(conf) -%} (threadIdx.x & ({{conf.xdim}}-1)) {%- endmacro %}
{% macro yid(conf) -%} (threadIdx.x / {{conf.xdim}}) {%- endmacro %}
{% macro coop_size(conf) -%} ({{conf.xdim}} * {{conf.ydim}}) {%- endmacro %}

{% macro sync(conf) %}
    {%- if conf.xdim == 32 -%} __sycnwarp(); {%- endif -%}
    {%- if conf.xdim > 32 -%} __sycnthreads(); {%- endif -%}
{% endmacro %}

{# coordinator functions #}